package com.javaee.xiangyang.converter;

import com.javaee.xiangyang.entity.enmu.impl.OrderState;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;

@Component
public class OrderStateConverter implements Converter<String, OrderState> {


    @Override
    public OrderState convert(String integer) {
        for (OrderState orderState : OrderState.values()){
            if (orderState.getCode() == Integer.parseInt(integer)){
                return orderState;
            }
        }
        return null;
    }
}
